#include <iostream>
using namespace std;

int month_28[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int month_29[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

bool isLeap(int year)
{
    return (year % 400 == 0) || (year % 100 != 0 && year % 4 == 0);
}

int Up(int year)
{
    int day = 0;
    for (int i = 1998; i < year; i++)
    {
        day += (isLeap(i) ? 366 : 365);
    }
    day = day + 4;
    day = (day % 7 + 7) % 7;
    //cout << day;
    return day;
}

int is13_5(int year, bool flag)
{
    int mon = 1, day = 1;
    int sum = 0;
    int week = Up(year);
    int stop = ((flag) ? 366 : 365);
    for (int i = 1; i <= stop; i++)
    {
        if (day == 13 && week == 5)
        {
            sum += 1;
            //printf("%d\n", mon);
        }
        week += 1;
        if (week > 7)
            week = 1;
        day++;
        if (day > ((flag) ? (month_29[mon - 1]) : (month_28[mon - 1])))
        {
            day = 1;
            mon += 1;
        }
    }
    return sum;
}

int main()
{
    int year;
    cin >> year;
    printf("%d", is13_5(year, isLeap(year)));
    return 0;
}